import { reqGetMyOrderList } from "@/api"
const state = {
    myOrderList:[],
    pagination:{}
}
const actions = {
    async getMyOrderList({commit},params){
        const result = await reqGetMyOrderList(params)
        console.log(result);
        if(result.code===200){
            commit('GETMYORDERLIST',result.data)
            return 'ok'
        }else return Promise.reject(new Error('fail'))
    }
}
const mutations = {
    GETMYORDERLIST(state,data){
        state.myOrderList = data.records
        // 分解有关分页器数据
        const {current,pages,size,total} = data
        state.pagination.current = current
        state.pagination.pages = pages
        state.pagination.size = size
        state.pagination.total = total
    }
}
const getters = {}
export default { state, actions, mutations, getters }